package cn.zhaoyuening.schoolmates.web.general;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cn.zhaoyuening.schoolmates.domain.SchoolmatesCategory;
import cn.zhaoyuening.schoolmates.service.SchoolmatesCategoryService;
import cn.zhaoyuening.schoolmates.utils.JsonUtils;
import cn.zhaoyuening.schoolmates.utils.page.PageBean;

@RestController
public class SchoolmatesCategoryController {
	@Autowired
	private SchoolmatesCategoryService schoolmatesCategoryService;

	@RequestMapping(value="schoolmatesCategorys",method=RequestMethod.GET)
	public String articleCategory(String order,Integer offset, Integer limit) {
		Long total = schoolmatesCategoryService.getTotalRecord();
		List<SchoolmatesCategory> list = schoolmatesCategoryService.findAll(null, null, offset, limit,"id "+order);
		PageBean<SchoolmatesCategory> pageBean = new PageBean<>(total, list);
		return JsonUtils.objectToJson(pageBean);
	}
	


}
